<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>使用阿里通用接口的demo</title>
    <script src="http://a.tbcdn.cn/s/kissy/1.3.0/kissy-min.js" charset="utf-8"></script>

</head>
<body>
<h2>使用阿里通用接口的demo</h2>
<div class="grid">
    <input type="file" class="g-u" id="J_UploaderBtn" value="上传图片" name="Filedata" >
    <input type="hidden" id="J_Urls" name="urls" value="" />
    <div class="g-u">还可以上传<span id="J_UploadCount">3</span>张图片</div>
</div>
<ul id="J_UploaderQueue" class="grid"></ul>
<script>
    var S = KISSY;
    if(S.Config.debug){
        var srcPath = "../../../../";
        S.config({
            packages:[
                {
                    name:"gallery",
                    path:srcPath,
                    charset:"utf-8"
                }
            ]
        });
    }

    S.use('gallery/uploader/1.4/aliUploader,gallery/uploader/1.4/themes/imageUploader/index,gallery/uploader/1.4/themes/imageUploader/style.css', function (S, AliUploader,ImageUploader) {
        var plugins = AliUploader.plugins;
        var uploader = new AliUploader('#J_UploaderBtn');
        //使用主题
        uploader.theme(new ImageUploader({
            queueTarget:'#J_UploaderQueue'
        }));
        //验证插件
        uploader.plug(new plugins.Auth({
                    //最多上传个数
                    max:3,
                    //图片最大允许大小
                    maxSize:2000
                }))
                //url保存插件
                .plug(new plugins.UrlsInput({target:'#J_Urls'}))
                //进度条集合
                .plug(new plugins.ProBars())
                //拖拽上传
                .plug(new plugins.Filedrop())
                //图片预览
                .plug(new plugins.Preview())
        ;
    })

</script>
</body>
</html>